<?php

//echo $this->smartButton('Nowa płatność', $this->url(array('controller' => 'payment', 'action' => 'save',), 'admin', true), array());

function renderSubject($row, $view) {
    switch ($row['source_name']) {
        case 'offer':
            $url = $view->url(array('controller' => 'offer', 'action' => 'show', 'id' => $row['offer_code'], 'module' => 'default'), 'default', true);
            return 'Ogłoszenie: <a href="' . $url . '">' . $view->escape($row['offer_title']) . '</a>';
        case 'catalog':
            $url = $view->url(array('controller' => 'catalog', 'action' => 'show', 'id' => $row['catalog_code'], 'module' => 'default'), 'default', true);
            return 'Wpis: <a href="' . $url . '">' . $view->escape($row['catalog_title']) . '</a>';
        default:
            return '[' . $row['source_name'] . ']';
    }
    return '-';
}

echo $this->table($this->list, array(
    'Użytkownik' => 'email',
    'Wartość' => 'amount',
    'Podmiot' => array('eval' => 'renderSubject($row, $view)'),
    'Status płatności' => array('eval' => 'Application_Model_DAO_Payment::getTranslatetPaymentStatus($row["status"])'),
    'Operacje' => array(
        $this->smartButton('Zmiana stanu', $this->url(array('controller' => 'payment', 'action' => 'save', 'id' => '${item.code}'), 'admin', true), array('size' => 'mini',))
    )
        )
);